import React, { Component } from "react";
import { Row, Col } from "bee-layout";
import DatePicker from "bee-datepicker";
import './index.less'

import moment from "moment";
import 'moment/locale/zh-cn';
moment.locale('zh-cn');


const now = moment();

const { RangePicker } = DatePicker;

const format3 = "YYYY-MM-DD HH:mm:ss";

function formatValue(value, format) {
    return (value && value.format(format)) || '';
}

function onSelect(d) {
    //console.log(d);
}



export default class RangeTimePicker extends Component {
    constructor(props) {
        super(props);
        this.state = {
            value: '',
            v: ''
        };
    }

    onStartChange = (value) => {
        this.setState({
            startValue: value[0],
            startOpen: false,
            endOpen: true,
        });
    }

    remove() {
        this.setState({ value: '' })
    }
    render() {
        let { startTime, endTime, } = this.props;
        let value = startTime && endTime ? [moment(startTime), moment(endTime)] : '';
        return (

            <RangePicker
                placeholder={'开始时间 ~ 结束时间'}
                dateInputPlaceholder={['开始时间', '结束时间']}
                value={value}
                {...this.props}
                onChange={(timeArr) => { this.props.onChange(timeArr, this.props.item) }}
            />

        );
    }
}